package Work0513;

public class Rectangle extends Diagram {
	private double b;

	public Rectangle(double a, double b) {
		super(a);
		this.b = b;

	}

	public void getLength() {
		if (getA() > 0 && b > 0) {
			double length = (getA() + b) * 2;
			System.out.println("该长方形的周长为" + length);
			return;
		}
		System.out.println("该两条边无法组成长方形");
	}

	public void getArea() {
		if (getA() > 0 && b > 0) {
			double area = getA() * b;
			System.out.println("该长方形的面积为:" + area);
			return;
		}
		System.out.println("该两条边无法组成长角形");
	}

}
